from main import app

print("所有注册的路由:")
for route in app.routes:
    route_type = type(route).__name__
    if hasattr(route, 'path'):
        if hasattr(route, 'methods'):
            print(f"路径: {route.path}, 方法: {route.methods}, 类型: {route_type}, 名称: {getattr(route, 'name', 'N/A')}")
        else:
            print(f"路径: {route.path}, 类型: {route_type}, 名称: {getattr(route, 'name', 'N/A')}")

# 查找与注册相关的路由
print("\n与注册相关的路由:")
found = False
for route in app.routes:
    if hasattr(route, 'path') and ('reg' in route.path.lower() or 'register' in route.path.lower()):
        print(f"路径: {route.path}, 方法: {getattr(route, 'methods', 'N/A')}, 类型: {type(route).__name__}, 名称: {getattr(route, 'name', 'N/A')}")
        found = True
    # 检查是否有子应用路由
    elif hasattr(route, 'app') and hasattr(route.app, 'routes'):
        for sub_route in route.app.routes:
            if hasattr(sub_route, 'path') and ('reg' in sub_route.path.lower() or 'register' in sub_route.path.lower()):
                full_path = route.path.rstrip('/') + '/' + sub_route.path.lstrip('/') if sub_route.path != '/' else route.path
                print(f"路径: {full_path}, 方法: {getattr(sub_route, 'methods', 'N/A')}, 类型: {type(sub_route).__name__}, 名称: {getattr(sub_route, 'name', 'N/A')}")
                found = True

if not found:
    print("未找到与注册相关的路由")

# 查看 /admin 路径下的所有路由，因为注册功能可能在管理后台
print("\n管理后台路径下的路由:")
for route in app.routes:
    if hasattr(route, 'path') and '/admin' in route.path:
        print(f"路径: {route.path}, 方法: {getattr(route, 'methods', 'N/A')}, 类型: {type(route).__name__}")
        # 检查是否有子应用路由
        if hasattr(route, 'app') and hasattr(route.app, 'routes'):
            for sub_route in route.app.routes:
                if hasattr(sub_route, 'path'):
                    full_path = route.path.rstrip('/') + '/' + sub_route.path.lstrip('/') if sub_route.path != '/' else route.path
                    print(f"  - {full_path}, 方法: {getattr(sub_route, 'methods', 'N/A')}, 类型: {type(sub_route).__name__}")